
#include <stdio.h>
#include "wm_hal.h"

void Error_Handler(void);
static uint8_t txbuf[100];

int main(void)
{
	SystemClock_Config(CPU_CLK_240M);
	printf("enter main\r\n");
	
	HAL_SSPI_Init(INTERFACE_TYPE_SSDIO);
	while (1)
	{
		HAL_Delay(1000);
	}
}

void HAL_SSPI_RxDataCpltCallback(uint8_t *buf)
{
	char *p = "w800 sdio recevied data test ok\n";
	uint32_t len = strlen(p);
	
	printf("rx data: %s\n", buf);
	memcpy(txbuf, p, len);
	txbuf[len] = '\0';
	HAL_SSPI_Transmit(txbuf, len + 1);
}

void HAL_SSPI_RxCmdCpltCallback(uint8_t *buf)
{
	char *p = "w800 sdio recevied cmd test ok\n";
	uint32_t len = strlen(p);
	
	printf("rx cmd: %s\n", buf);
	memcpy(txbuf, p, len);
	txbuf[len] = '\0';
	HAL_SSPI_Transmit(txbuf, len + 1);
}

void Error_Handler(void)
{
	while (1)
	{
	}
}

void assert_failed(uint8_t *file, uint32_t line)
{
	printf("Wrong parameters value: file %s on line %d\r\n", file, line);
}